get function address from name [.debug_info ??]

Posted by user361190 on Stack Overflow See other posts from Stack Overflow or by user361190
Published on 2010-06-14T17:41:29Z Indexed on 2010/06/14 18:52 UTC
Read the original article Hit count: 132

Filed under:
|
|

Hi,

I was trying to write a small debug utility and for this I need to get the function/global variable address given its name. This is built-in debug utility, which means that the debug utility will run from within the code to be debugged or in plain words I cannot parse the executable file.

Now is there a well-known way to do that ? The plan I have is to make the .debug_* sections to to be loaded into to memory [which I plan to do by a cheap trick like this in ld script]

.data { *(.data) __sym_start = .; (debug_); __sym_end = .; }

Now I have to parse the section to get the information I need, but I am not sure this is doable or is there issues with this - this is all just theory. But it also seems like too much of work :-) is there a simple way. Or if someone can tell upfront why my scheme will not work, it ill also be helpful.

Thanks in Advance, Alex.

© Stack Overflow or respective owner

Related posts about c

    Related posts about linker